package com.dev.demo;

/**
 * @description:
 * @className: MyClassLoaderDemo
 * @package: com.dev.demo
 * @author: yangzhi@hsyuntai.com
 * @date: 2019-04-13 15:26
 * @copyright: 版权归 HSYUNTAI 所有
 */
public class MyClassLoaderDemo {

    public static void main(String[] args) throws ClassNotFoundException {
        MyClassLoader cl1 = new MyClassLoader();
        String className = "com.dev.demo.IHelloService";
        Class<?> class1 = cl1.findClass(className);

        MyClassLoader cl2 = new MyClassLoader();
        Class<?> class2 = cl2.findClass(className);
        System.out.println("findClass->cl1:" + class1.hashCode());
        System.out.println("findClass->cl2:" + class2.hashCode());

        System.out.println("------------------------");
        MyClassLoader cl3 = new MyClassLoader();
        Class<?> class3 = cl3.loadClass(className);

        MyClassLoader cl4 = new MyClassLoader();
        Class<?> class4 = cl4.loadClass(className);
        System.out.println("loadClass->cl3:" + class3.hashCode());
        System.out.println("loadClass->cl4:" + class4.hashCode());
    }

}
